import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import instance from "./utils/request"
import Vant from 'vant';
import 'vant/lib/index.css';
import {
    Swipe,
    SwipeItem,
    Loading,
    DropdownMenu,
    DropdownItem,
    Empty,
    Cascader,
    Search,
    Picker,
    Uploader,
    Field
} from 'vant';
import "./font/iconfont.css"

Vue.use(Vant);
Vue.use(Cascader);
Vue.use(Uploader);
Vue.use(Empty);
Vue.use(Field);
Vue.use(Picker);
Vue.use(Search);
Vue.use(DropdownMenu);
Vue.use(DropdownItem);
Vue.use(Loading);
Vue.use(Swipe);
Vue.use(SwipeItem);
Vue.prototype.$http = instance
Vue.config.productionTip = false

router.beforeEach((to, from, next) => {
    if (to.path == '/rent' && !window.localStorage.getItem('token')) {
        next('/login');
    } else {
        next();
    }
})
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')